package de.tum.beilmeiner.im.shared.model;

import java.util.HashMap;
import java.util.HashSet;
import java.util.Map.Entry;
import java.util.Set;

import com.google.gwt.user.client.rpc.IsSerializable;
import de.novanic.eventservice.client.event.domain.Domain;

public class ChatRoom implements IsSerializable {

	private String roomId = null;
	private Domain UUID = null;
	private HashMap<String ,User> usersInRoom = null;
	private User creator = null;
	
	public ChatRoom()
	{};
	
	public ChatRoom(Domain UUID, User creator) {
		this.UUID = UUID;
		this.roomId = UUID.getName();
		usersInRoom = new HashMap<String, User>();
		this.creator = creator;
	}

	public String getRoomId() {
		return roomId;
	}

	public Domain getUUID() {
		return UUID;
	}

	public void setUUID(Domain uUID) {
		UUID = uUID;
	}

	public HashMap<String, User> getUsersInRoom() {
		return usersInRoom;
	}

	public void setUsersInRoom(HashMap<String, User> usersInRoom) {
		this.usersInRoom = usersInRoom;
	}

	public void setRoomId(String roomId) {
		this.roomId = roomId;
	}

	public void addUser(User user) {
		usersInRoom.put(user.getUserId(), user);
		
	}
	
	public Set<Entry<String, User>> getChatPartners()
	{
		Set<Entry<String, User>> userEntrySet = usersInRoom.entrySet();
		userEntrySet.remove(creator.getUserId());
		return userEntrySet;
	}
	

}
